import request from '@/utils/request'

// 抽去方法
export function randTouch() {
    return request({
        url: '/api/touch',
        method: 'get'
    })
}


// 根据等级获取类型
export function getColor(grade) {
    switch (grade) {
        case 1: return '#ffffff';
        case 2: return '#73e37d';
        case 3: return '#5cace4';
        case 4: return '#b69bd9';
        case 5: return '#d59433';
        case 6: return '#fb5b5b';
    }
    return '#ffffff'
}

export function getPrice(price){
    if(price === 0){
        return 0
    }
    const value = price/1000
    if(value%1===0){
        return Math.floor(value) + 'k'
    }else {
        return value.toFixed(1) + 'k'
    }
}